﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SLLottery.LotterySrv;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using SLLottery.Common;
namespace SLLottery
{
	/// <summary>
	/// WCF代理类
	/// </summary>
	public class WcfProxy
	{
		public WcfProxy() { }
		/// <summary>
		///	获取默认代理
		/// </summary>
		public static LotteryServiceClient GetProxy
		{
			get
			{
				EndpointAddress address = new EndpointAddress(Constant.WcfSrvIp);

				BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
				binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
				binding.SendTimeout = new TimeSpan(0, 10, 0);
				binding.MaxReceivedMessageSize = 2147483647;
				binding.OpenTimeout = new TimeSpan(0, 10, 0);
				binding.CloseTimeout = new TimeSpan(0, 10, 0);

				LotteryServiceClient client = new LotteryServiceClient(binding, address);
				EndpointBehavior endpointBehavior = new EndpointBehavior();
				client.Endpoint.Behaviors.Add(endpointBehavior);
				return client;
			}
		}
	}
}
